<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>Blank Page - Ace Admin</title>

		<meta name="description" content="" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="#(CPATH)/assets/css/bootstrap.css" />
		<link rel="stylesheet" href="#(CPATH)/assets/css/font-awesome.css" />

		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="#(CPATH)/assets/css/bootstrap-table.css">
		<link rel="stylesheet" href="#(CPATH)/assets/css/basejace.css">
		<link rel="stylesheet" href="#(CPATH)/assets/css/chosen.css" />
		<!-- <link rel="stylesheet" href="#(CPATH)/assets/css/bootstrap-multiselect.css" /> -->

		<!-- text fonts -->
		<link rel="stylesheet" href="#(CPATH)/assets/css/ace-fonts.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="#(CPATH)/assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />

		<!--[if lte IE 9]>
			<link rel="stylesheet" href="#(CPATH)/assets/css/ace-part2.css" class="ace-main-stylesheet" />
		<![endif]-->

		<!--[if lte IE 9]>
		  <link rel="stylesheet" href="#(CPATH)/assets/css/ace-ie.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->
		<script src="#(CPATH)/assets/js/ace-extra.js"></script>

		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

		<!--[if lte IE 8]>
		<script src="#(CPATH)/assets/js/html5shiv.js"></script>
		<script src="#(CPATH)/assets/js/respond.js"></script>
		<![endif]-->
	</head>

	<body class="no-skin">
		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>
			<form id="contentForm" action="" method="POST">
			<input type="hidden" name="pubUser.userid" value="#(pubUser.userid ??)"/>
			<div class="main-content">
			<div class="page-content">
			<!-- 提示信息条 -->
			#if(message != null)
			<div class="row">
				<div class="col-xs-12">
					<div class="alert alert-info">
						<button type="button" class="close" data-dismiss="alert">
							<i class="ace-icon fa fa-times"></i>
						</button>
						#(message)
					</div>
				</div>
			</div><!-- ./提示信息条 -->
			#end
			<div class="row">
				<div class="col-sm-12 form-field">
					<div class="widget-box transparent">
						<div class="widget-header widget-header-flat">
							<h4 class="widget-title smaller">新增员工</h4>
	
							<div class="widget-toolbar">
								#if(ISEDIT == 'TRUE')
									<button class="btn btn-sm btn-info" onclick="doSave();return false;"><i class="ace-icon fa fa-floppy-o bigger-120"></i>保存</button>
								#elseif(ISEDIT == 'FALSE' && ISNEW == 'FALSE')
									<button class="btn btn-sm btn-info" onclick="doEdit('pubUser.userid');return false;"><i class="ace-icon fa fa-floppy-o bigger-120"></i>修改</button>
								#end
								<button class="btn btn-sm" onclick="javascript:doReturn();return false;"><i class="icon-search align-top"></i>返回</button>
							</div>
						</div>
	
						<div class="widget-body">
							<div class="widget-main">
								<div class="row">
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">姓名</label>
										<div class="col-xs-8">
											<input type="text" id="username" name="pubUser.username" value="#(pubUser.username ??)" class="col-xs-12" placeholder="Username" />
											<!-- <div class="help-block col-xs-12 col-sm-7">这是表单验证错误信息展示形式</div> 上面input的class可以设置的更窄一点，例如col-xs-10; -->
										</div>
									</div>
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">手机</label>
										<div class="col-xs-8">
											<input type="text" id="mobileno" name="pubUser.mobileno" value="#(pubUser.mobileno ??)" class="col-xs-10" placeholder="13800138000"/>
										</div>
									</div>
								</div>
								<div class="row">
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">年龄</label>
										<div class="col-xs-8">
											<input type="text" name="pubUser.age" value="#(pubUser.age ??)"class="col-xs-10"/>
										</div>
									</div>
									<!-- <div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">性别</label>
										<div class="col-xs-8">
											<div class="col-xs-10 no-padding-top">
												<input name="pubUser.sex" type="radio" value="1" class="ace no-padding-top" />
												<span class="lbl">男</span>&nbsp;&nbsp;&nbsp;&nbsp;
												<input name="pubUser.sex" type="radio" value="0" class="ace" />
												<span class="lbl">女</span>&nbsp;&nbsp;&nbsp;&nbsp;
												<input name="pubUser.sex" type="radio" value="2" checked="checked" class="ace" />
												<span class="lbl">未知</span>
											</div>
											<div class="help-block col-xs-12 col-sm-7"></div>
										</div>
									</div> -->
								</div>
								<div class="row">
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">性别</label>
										<div class="col-xs-8">
											<select id="sex" name="pubUser.sex" class="col-xs-10" id="sex" data-placeholder="选择性别...">
												<option value=""></option>
												<option value="1" #(pubUser.sex ?? == 1 ? 'selected' : '')>男</option>
												<option value="0" #(pubUser.sex ?? == 0 ? 'selected' : '')>女</option>
											</select>
										</div>
									</div>
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">入职时间</label>
										<div class="col-xs-8">
											<input type="date" id="pubUser.intime" name="pubUser.intime" value="#(pubUser.intime ??)" class="col-xs-10" placeholder="格式 2017-03-12"/>
										</div>
									</div>
								</div>
								<div class="row">
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">状态</label>
										<div class="col-xs-8">
											<select id="state" name="pubUser.state" class="col-xs-10" id="sex" data-placeholder="选择性别...">
												<option value=""></option>
												<option value="1" #(pubUser.state ?? == 1 ? 'selected' : '')>在职</option>
												<option value="0" #(pubUser.state ?? == 0 ? 'selected' : '')>离职</option>
											</select>
										</div>
									</div>
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">离职时间</label>
										<div class="col-xs-8">
											<input type="date" id="outtime" name="pubUser.outtime" value="#(pubUser.outtime ??)" class="col-xs-10" placeholder=""/>
										</div>
									</div>
								</div>
								
								<div class="space-4"></div>
								
								
								
															
							</div> <!-- ./widget-main -->
							
							<div class="widget-toolbox padding-8 clearfix text-center">
								#if(ISEDIT == 'TRUE')
									<button class="btn btn-sm btn-info" onclick="doSave();return false;"><i class="ace-icon fa fa-floppy-o bigger-120"></i>保存</button>
								#elseif(ISEDIT == 'FALSE' && ISNEW == 'FALSE')
									<button class="btn btn-sm btn-info" onclick="doEdit();return false;"><i class="ace-icon fa fa-floppy-o bigger-120"></i>修改基本信息</button>
								#end
								<button class="btn btn-sm" style="margin-left:60px;" onclick="doReturn(); return false;"><i class="icon-search align-top"></i>返回</button>
							</div>
							
							<!-- 角色操作 -->
							<div class="widget-main" id="setExtend">
								<!-- 员工所属角色  -->
								<div class="row">
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">选择角色</label>
										<div class="col-xs-8">
											<select multiple="" class="chosen-select col-xs-10" id="roles" name="pubUser.roles" data-placeholder="请选择所属角色">
												<option value="1">老板</option>
												<option value="2">店长</option>
												<option value="3">店面销售</option>
												<option value="4">施工技师</option>
												<option value="5">渠道销售</option>
											</select>
										</div>
									</div>
									<div class="col-xs-12 col-sm-2 ">
										<div class="padding-8 clearfix text-center">
										<button class="btn btn-info btn-sm"><i class="ace-icon fa fa-floppy-o bigger-120"></i>设置角色</button>
										</div>
									</div>
								</div>
							
								<div class="space-4"></div>
								<!-- 员工所属部门  -->
								<div class="row">
									<div class="col-xs-12 col-sm-6">
										<label class="col-xs-4">所属部门</label>
										<div class="col-xs-8">
											<select multiple="" class="chosen-select col-xs-10" id="departments" name="pubUser.departments" data-placeholder="请选择所属部门">
												<option value="1">滨湖一店</option>
												<option value="2">信地二店</option>
												<option value="3">施工部</option>
											</select>
											<div class="help-block col-xs-12 col-sm-7"></div>
										</div>
									</div>
									<div class="col-xs-12 col-sm-2 text-center">
										<button class="btn btn-info btn-sm"><i class="ace-icon fa fa-floppy-o bigger-120"></i>设置部门</button>
									</div>
								</div>
								
							</div>
						</div>		<!-- ./widget-body -->
					</div>
				</div>
			</div>	<!-- ./outest row -->	
			
			
			</div> <!-- ./main-content -->
			</div>
			</form>	
		</div> <!-- ./main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script type="text/javascript">
			window.jQuery || document.write("<script src='#(CPATH)/assets/js/jquery.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='#(CPATH)/assets/js/jquery1x.js'>"+"<"+"/script>");
</script>
<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='#(CPATH)/assets/js/jquery.mobile.custom.js'>"+"<"+"/script>");
		</script>
		<script src="#(CPATH)/assets/js/bootstrap.js"></script>

		<!-- page specific plugin scripts -->
		<script src="#(CPATH)/assets/js/bootstrap-table/bootstrap-table.js"></script>
		<script src="#(CPATH)/assets/js/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
		<script src="#(CPATH)/assets/js/chosen.jquery.js"></script>
		<script src="#(CPATH)/assets/js/jquery.validate.js"></script>
		<script src="#(CPATH)/assets/js/basejace.jquery.validate.js"></script>
		<script src="#(CPATH)/assets/js/basejace-page.js"></script>
		
		
		<!-- ace scripts -->
		<script src="#(CPATH)/assets/js/ace/elements.scroller.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.colorpicker.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.fileinput.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.typeahead.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.wysiwyg.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.spinner.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.treeview.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.wizard.js"></script>
		<script src="#(CPATH)/assets/js/ace/elements.aside.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.ajax-content.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.touch-drag.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.sidebar.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.sidebar-scroll-1.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.submenu-hover.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.widget-box.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.settings.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.settings-rtl.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.settings-skin.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.widget-on-reload.js"></script>
		<script src="#(CPATH)/assets/js/ace/ace.searchbox-autocomplete.js"></script>

		<!-- inline scripts related to this page -->
		<script type="text/javascript">
			cmdReturn = "#(CPATH)/system/user/show";
			#if(ISNEW == 'TRUE')
				cmdSave = "#(CPATH)/system/user/save?ISNEW=TRUE";
			#else
				cmdSave = "#(CPATH)/system/user/save?ISNEW=FALSE";
			#end
			cmdEdit = "#(CPATH)/system/user/edit";
			 // 多选 select 数据初始化
	        function chose_mult_set_ini(select, values) {
	            var arr = values.split(',');
	            var length = arr.length;
	            var value = '';
	            for (i = 0; i < length; i++) {
	                value = arr[i];
	                $(select + " option[value='" + value + "']").attr('selected', 'selected');
	            }
	            //$(select).trigger("liszt:updated");
	        }
			//-------------- 初始化多选 下拉框
			chose_mult_set_ini('#roles', '#(roleids)');
			$('#roles').chosen({allow_single_deselect:true}); 
			
			chose_mult_set_ini('#departments', '#(dptids)');
			//---------------
				
				

			
			function doSave() {
				
				$("#contentForm").validate({
					errorElement: "div",
					errorClass: "col-xs-12 col-sm-7 red",
					rules: {
						
						'pubUser.username':{
							required:true,
							minlength: 2
						},
						'pubUser.mobileno':{
							required:true,
							regex: /^13\d{9}$/
						},
						'pubUser.state':{
							required:true
						},
						'pubUser.intime':{
							required:true
						},
						/* 'pubUser.age':{
							minlength: 2
						},
						'pubUser.roles':{
							required:true
						},
						'pubUser.departments': {
							required:true
						} */
						'pubUser.sex':{
							required: true
						}
						
					}
				});
				
				$("#contentForm").attr("action", cmdSave).submit();
				
			}
			
			function doEdit() {
				window.location = cmdEdit + "?PK=" + $("input[name='pubUser.userid']").val();
			}
			
			init_content("#(ISEDIT ??)");

			(function(){
				#if(ISEDIT == "TRUE")
					$("#setExtend").hide();
				#else
					$("#setExtend").show();
					$("#roles").removeAttr("disabled");
					$("#departments").removeAttr("disabled");
				#end
			})();

		</script>
	</body>
</html>